function [perct_act thresh_arr]=cell_act_sorted_multiTime(ExpGroup)
adata_dir='\\argon.fmi.ch\keller.g\AData\';
tmp_data_dir = '\\KELLER-RIG1-ANA\RawData\';
perct_act={};
thresh_arr=[];
for fnd=1:length(ExpGroup)
    display(['Exp: ' num2str(ExpGroup(fnd)) ' *****************************']);
    [adata_file,mouse_id,userID]=find_adata_file(ExpGroup(fnd),adata_dir);
    orig=load([adata_dir userID '\' mouse_id '\' adata_file],'ROIs','nbr_frames','aux_files');
    aux_data=[];
    try
        for ind=1:length(orig.aux_files)
            if exist([tmp_data_dir userID '\' mouse_id '\' orig.aux_files{ind}],'file');
                disp(['loading file ' orig.aux_files{ind} ' from local tmpdata directory']);
                curr_load_path=[tmp_data_dir userID '\' mouse_id '\' orig.aux_files{ind}];
            else
                disp(['loading file ' orig.aux_files{ind} ' from the network RawData directory']);
                curr_load_path=[rdata_dir userID '\' mouse_id '\' orig.aux_files{ind}];
            end
            tmp_data=load_lvd(curr_load_path);
            tmp_frames=get_frame_times(tmp_data(2,:));
            
            if orig.nbr_frames(ind)~=length(tmp_frames)
                if max(diff(tmp_frames))/median(diff(tmp_frames))<1.5 & length(tmp_frames)>orig.nbr_frames(ind)
                    disp('NC WARNING! Probably scanning too fast for FPGA to stop in the same frame')
                    disp(['--- ' num2str(length(tmp_frames)-orig.nbr_frames(ind)) ' frames too many ---'])
                    tmp_data(2,tmp_frames(orig.nbr_frames(ind)+1):end)=0;
                else
                    disp('CRITICAL WARNING! - aux data longer than it should be.')
                    [~,last_bad_frame]=max(diff(tmp_frames));
                    tmp_data=tmp_data(:,ceil(mean([tmp_frames(last_bad_frame) tmp_frames(last_bad_frame+1)])):end);
                end
            end
            aux_data(:,end+1:end+length(tmp_data))=tmp_data;
        end
        frame_times=get_frame_times(aux_data(2,:));
    catch
        disp('Did not load aux data')
    end
    [velP,velM,velP_ind,velM_ind,velP_raw,velM_raw]=get_vel_ind_from_adata(aux_data);
    runM=velM_ind;
    runP=velP_ind;
    stim_id=round(aux_data(3,:)*2);
    shutterOpen=find(abs(diff(aux_data(1,:)>1))==1);
    if length(orig.nbr_frames)>5
        order=[];
        for xnd=1:length(orig.nbr_frames)
            if orig.nbr_frames(xnd)==20000
                if xnd==length(orig.nbr_frames)
                    order(xnd)=3;
                else
                    order(xnd)=1;
                end
            else
                order(xnd)=2;
            end
        end
    else
        order=[1 2 1 2 3];
    end
    a=1:length(order);
    order(max(a(order==2))+1:end)=3;
    cnt=1;
    for gnd=1:length(orig.ROIs)
        for hnd=1:length(orig.ROIs{gnd})
%             act=ftfil(orig.ROIs{gnd}(hnd).activity,10,0,5);
            act=psmooth(act);
            raw_act=act/median(act);
            raw_act=raw_act-1;
            thresh=det_thresh_for_peak_resp(raw_act);
            raw_act(raw_act<thresh)=0;
            ROI_act=map_ROI_act_to_aux_data(raw_act,frame_times(gnd:4:end),length(aux_data));
            perct_act{fnd}(cnt,:)=sort_act(ROI_act,runM,runP,stim_id,shutterOpen,order);
            thresh_arr(cnt,fnd)=thresh;
            cnt=cnt+1;
        end
    end
end